<?php
declare (strict_types = 1);

namespace common\service;

class JobService extends \think\Service
{

    /**
     * 库存回滚
     * @param $redis
     * @param int $number
     * @param bool $isPush
     * @return bool
     */
    public static function pushSeckillStock(int $number,bool $isPush = false,int $id)
    {
        $Redis = new \Redis();
        $Redis->connect('127.0.0.1',6379);
        $Redis->auth('123456');

        $listKey="goods_list_".$id;
        if (!$isPush) {
            $Redis->del($listKey);
        }
        for ($i = 1; $i <= $number; $i++) {
            $Redis->lPush($listKey, $i);
        }
        return true;
    }
}
